﻿set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO

If exists(select 1 from sysobjects where xtype = 'P' and name = 'Cliente_Get')
Begin
   Drop proc Cliente_Get
End

GO

CREATE  Proc [dbo].[Cliente_Get]
	(@Emp_Id smallint,
	 @Cliente_Id int = NULL) AS
Begin
	Set nocount on

	SELECT	Emp_Id AS EmpresaId, Cliente_Id AS Id, Cliente_Nombre AS Nombre, Cliente_Cedula AS Cedula,
			Cliente_Telefono AS Telefono, Cliente_Contacto AS Contacto, 
			Cliente_Contacto_Telefono AS ContactoTel, Cliente_Contacto_Ext AS ContactoExt,
			Cliente_Contacto_Correo AS ContactoCorreo
	FROM Cliente 
	WHERE	Emp_Id = @Emp_Id
	AND		Cliente_Id = ISNULL(@Cliente_Id, Cliente_Id)
	ORDER BY Cliente_Nombre
	Set nocount on
End

Go

  